package com.example.index.widget

import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.widget.FrameLayout
import com.example.index.extension.ev

class GestureView : View {
    val TAG = "GestureView"


    constructor(context: Context?) : this(context, null)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {

    }

}


class GestureViewGroup : FrameLayout {

    constructor(context: Context) : super(context)
    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)


    override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
        Log.i("ChildViewGroup", "onInterceptTouchEvent:${ev?.ev()} ")
        return true
    }

    override fun onTouchEvent(event: MotionEvent?): Boolean {
        Log.i("ChildViewGroup", "onTouchEvent:${event?.ev()} ")
        return false
    }
}


class TopViewGroup : FrameLayout {

    constructor(context: Context) : super(context)
    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

    override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
        Log.i("TopViewGroup", "onInterceptTouchEvent:${ev?.ev()} ")
        return super.onInterceptTouchEvent(ev)
    }


    override fun onTouchEvent(event: MotionEvent?): Boolean {
        Log.i("TopViewGroup", "onTouchEvent:${event?.ev()} ")
        return super.onTouchEvent(event)
    }
}